# -*- mode: python -*-

Import("env")

env.Library(
    target='update_common',
    source=[
        'field_checker.cpp',
        'log_builder.cpp',
        'path_support.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/bson',
        '$BUILD_DIR/mongo/db/common',
        '$BUILD_DIR/mongo/foundation',
    ],
)

env.CppUnitTest(
    target='field_checker_test',
    source=[
        'field_checker_test.cpp',
    ],
    LIBDEPS=[
        'update_common',
    ],
)

env.CppUnitTest(
    target='log_builder_test',
    source=[
        'log_builder_test.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/mutable_bson_test_utils',
        'update_common',
    ],
)

env.CppUnitTest(
    target='path_support_test',
    source=[
        'path_support_test.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/mutable_bson_test_utils',
        '$BUILD_DIR/mongo/expressions',
        'update_common',
    ],
)

env.Library(
    target='update',
    source=[
        'modifier_add_to_set.cpp',
        'modifier_bit.cpp',
        'modifier_compare.cpp',
        'modifier_current_date.cpp',
        'modifier_inc.cpp',
        'modifier_object_replace.cpp',
        'modifier_pop.cpp',
        'modifier_pull.cpp',
        'modifier_pull_all.cpp',
        'modifier_push.cpp',
        'modifier_rename.cpp',
        'modifier_set.cpp',
        'modifier_unset.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/expressions',
        '$BUILD_DIR/mongo/global_optime',
        'update_common',
    ],
)

env.CppUnitTest(
    target='modifier_add_to_set_test',
    source='modifier_add_to_set_test.cpp',
    LIBDEPS=[
        '$BUILD_DIR/mongo/mutable_bson_test_utils',
        'update',
    ],
)

env.CppUnitTest(
    target='modifier_bit_test',
    source='modifier_bit_test.cpp',
    LIBDEPS=[
        '$BUILD_DIR/mongo/mutable_bson_test_utils',
        'update',
    ],
)

env.CppUnitTest(
    target='modifier_compare_test',
    source='modifier_compare_test.cpp',
    LIBDEPS=[
        '$BUILD_DIR/mongo/mutable_bson_test_utils',
        'update',
    ],
)

env.CppUnitTest(
    target='modifier_current_date_test',
    source='modifier_current_date_test.cpp',
    LIBDEPS=[
        '$BUILD_DIR/mongo/mutable_bson_test_utils',
        'update',
    ],
)

env.CppUnitTest(
    target='modifier_inc_test',
    source='modifier_inc_test.cpp',
    LIBDEPS=[
        '$BUILD_DIR/mongo/mutable_bson_test_utils',
        'update',
    ],
)

env.CppUnitTest(
    target='modifier_object_replace_test',
    source='modifier_object_replace_test.cpp',
    LIBDEPS=[
        '$BUILD_DIR/mongo/mutable_bson_test_utils',
        'update',
    ],
)

env.CppUnitTest(
    target='modifier_pop_test',
    source='modifier_pop_test.cpp',
    LIBDEPS=[
        '$BUILD_DIR/mongo/mutable_bson_test_utils',
        'update',
    ],
)

env.CppUnitTest(
    target='modifier_push_sorter_test',
    source='modifier_push_sorter_test.cpp',
    LIBDEPS=[
        'update',
    ],
)

env.CppUnitTest(
    target='modifier_pull_all_test',
    source='modifier_pull_all_test.cpp',
    LIBDEPS=[
        '$BUILD_DIR/mongo/mutable_bson_test_utils',
        'update',
    ],
)

env.CppUnitTest(
    target='modifier_pull_test',
    source='modifier_pull_test.cpp',
    LIBDEPS=[
        '$BUILD_DIR/mongo/mutable_bson_test_utils',
        'update',
    ],
)

env.CppUnitTest(
    target='modifier_push_test',
    source='modifier_push_test.cpp',
    LIBDEPS=[
        '$BUILD_DIR/mongo/mutable_bson_test_utils',
        'update',
    ],
)

env.CppUnitTest(
    target='modifier_rename_test',
    source='modifier_rename_test.cpp',
    LIBDEPS=[
        '$BUILD_DIR/mongo/mutable_bson_test_utils',
        'update',
    ],
)

env.CppUnitTest(
    target='modifier_set_test',
    source='modifier_set_test.cpp',
    LIBDEPS=[
        '$BUILD_DIR/mongo/mutable_bson_test_utils',
        'update',
    ],
)

env.CppUnitTest(
    target='modifier_unset_test',
    source='modifier_unset_test.cpp',
    LIBDEPS=[
        '$BUILD_DIR/mongo/mutable_bson_test_utils',
        'update',
    ],
)

env.Library(
    target='update_driver',
    source=[
        'modifier_table.cpp',
        'update_driver.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/bson',
        '$BUILD_DIR/mongo/db/common',
        '$BUILD_DIR/mongo/db/query/query_planner',
        '$BUILD_DIR/mongo/update_index_data',
        'update',
    ],
)

env.CppUnitTest(
    target='modifier_table_test',
    source='modifier_table_test.cpp',
    LIBDEPS=[
        'update_driver',
    ],
)

env.CppUnitTest(
    target='update_driver_test',
    source='update_driver_test.cpp',
    LIBDEPS=[
        '$BUILD_DIR/mongo/mutable_bson_test_utils',
        '$BUILD_DIR/mongo/db/query/query_planner',
        'update_driver',
    ],
)
